﻿using System;

namespace Haro
{
    public class Debug
    {
        /// <summary>
        /// Contains the list of methods by which debug statements can be output.
        /// </summary>
        public enum DebugType
        {
            Text, Voice
        }

        private static bool m_bEnabled = true;
        private static DebugType m_OutputType = DebugType.Text;

        /// <summary>
        /// Gets or sets setting which determines how the incoming debug messages will be output.
        /// </summary>
        public static DebugType OutputType
        {
            get { return m_OutputType; }
            set { m_OutputType = value; }
        }

        /// <summary>
        /// Gets or sets the value which allows for enabling of disabling of the Debug system.
        /// </summary>
        public static bool Enabled
        {
            get { return m_bEnabled; }
            set { m_bEnabled = value; }
        }

        /// <summary>
        /// Outputs the debug statement passed to it using the selected medium.
        /// </summary>
        /// <param name="DebugMessage">String containing the debug message.</param>
        public static void Output(string DebugMessage)
        {
            if (!Enabled)
                return;

            switch (OutputType)
            {
                case DebugType.Text:
                    Console.WriteLine(DebugMessage);
                    break;
                case DebugType.Voice:
                    Speech.SpeechOutput.Speak(DebugMessage);
                    break;
                default:
                    throw new Exception("Invalid value used for OutputType to output debug message.");
            }
        }
    }
}
